#include <QCoreApplication>
#include "httplistener.h"
#include "HttpServerHandler.h"
#include "SqliteManager.h"

using namespace stefanfrings;

int main(int argc, char *argv[]) {
    QCoreApplication app(argc, argv);

    // 加载服务器配置
    QSettings* settings = new QSettings("config.ini", QSettings::IniFormat);
    settings->setValue("port", 8080); // 端口号
    settings->setValue("maxThreads", 10); // 最大线程数

    // 初始化数据库
    SqliteManager::getInstance();

    // 启动HTTP服务器
    new HttpListener(settings, new HttpServerHandler(), &app);
    qInfo() << "Server started on port" << settings->value("port").toInt();

    return app.exec();
}
